package ce.com.cenewbluesdk.uitl;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by Administrator on 2016/11/22 0022.
 */
public class CEBlueSharedPreference {
    private static CEBlueSharedPreference instance;
    private static Context context;
    private SharedPreferences blueSharePref;

    public CEBlueSharedPreference() {
        blueSharePref = context.getSharedPreferences("blueToothData", Context.MODE_PRIVATE);
    }

    public synchronized static CEBlueSharedPreference getInstance(Context context) {
        if (CEBlueSharedPreference.context == null) {
            CEBlueSharedPreference.context = context.getApplicationContext();
        }
        if (instance == null) {
            instance = new CEBlueSharedPreference();
        }
        return instance;
    }

    public void setBlueToothAddress(String key, String address) {
        SharedPreferences.Editor editor = blueSharePref.edit();
        editor.putString(key, address);
        editor.apply();
    }
    public String getBlueToothAddress(String key){
        return blueSharePref.getString(key,"");
    }

    public void setNewK3OTAFileVersion(String string){
        SharedPreferences.Editor editor = blueSharePref.edit();
        editor.putString("getNewK3OTAFileVersion", string);
        editor.apply();
    }

    public String getNewK3OTAFileVersion(){
        return blueSharePref.getString("getNewK3OTAFileVersion","");
    }


}
